@echo off
chcp 65001 >nul
echo 🚀 MongoDB Sync for Windows
echo ==========================

echo.
echo [INFO] Starting MongoDB databases...
docker-compose -f docker-compose-fixed.yml up -d mongodb-source mongodb-target

echo.
echo [INFO] Waiting for databases to initialize (45 seconds)...
timeout /t 45 /nobreak >nul

echo.
echo [INFO] Checking database status...
docker-compose -f docker-compose-fixed.yml ps

echo.
echo [INFO] Running sync process...
docker-compose -f docker-compose-fixed.yml --profile sync run --rm mongosync /home/mongosync/scripts/fixed-sync.sh

echo.
echo [SUCCESS] Setup completed!
echo.
echo [INFO] Connection Information:
echo   Source Database: mongodb://admin:password1@localhost:20727/admin
echo   Target Database: mongodb://admin:password2@localhost:20728/admin
echo.
echo [INFO] Commands:
echo   View logs: docker-compose -f docker-compose-fixed.yml logs
echo   Stop all: docker-compose -f docker-compose-fixed.yml down
echo   Run diagnosis: diagnose-sync.bat

pause 